package com.an.reflectandresource;

import java.lang.reflect.Field;

public class PrivateCarTestReflect {
    /*public  static  void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        System.out.println("11");
        PrivateCar privateCar = new PrivateCar();
        privateCar.driveCar();
        Class clazz = privateCar.getClass();
        Field color = clazz.getDeclaredField("carColor");
        //暴力反射
        color.setAccessible(true);
        color.set(privateCar,"绿");

        privateCar.driveCar();
    }*/
}
